package com.faithbj.schedule;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import com.faithbj.common.model.CheckTotal;
import com.faithbj.service.CheckTotalService;
import com.faithbj.service.CompareService;

/**
 * 电子比对交换自动运行任务类
 * 
 * @author chen liu
 */
@Component
public class CompareAutoRunJob extends AbstractJob {
    @Resource
    private CompareService compareService;
    
    @Resource
    private CheckTotalService ctService;

    @Override
    protected void executeInternal() throws Exception {
        System.out.println("*********开始执行定时任务");
        // 查询需要生成批次的受理记录
        Map<String, List<CheckTotal>> batchingMap = ctService.getCheckTotalMapForBatching();
        
        System.out.println(batchingMap.size());
        
        // 生成批次,发送委办
        System.out.println(compareService.genearateBatch(batchingMap));
        System.out.println("*********结束执行定时任务");
    }
}
